// @APIVersion 1.0.0
// @Title beego Test API
// @Description beego has a very cool tools to autogenerate documents for your API
// @Contact astaxie@gmail.com
// @TermsOfServiceUrl http://beego.me/
// @License Apache 2.0
// @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
package routers

import (
	"gitee.com/lzqysoft/ilive/controllers"

	"github.com/astaxie/beego"
	//	"github.com/astaxie/beego/context"
)

func init() {
	//	beego.Options("*",func(ctx *context.Context){
	//		ctx.Output.Body([]byte("success"))
	//	})
	//认证及主路由
	beego.Router("/", &controllers.AuthController{}, "*:Health")
	beego.Router("/Login", &controllers.AuthController{}, "*:Login")
	beego.Router("/Loginyz", &controllers.AuthController{}, "*:Loginyz")
	beego.Router("/Getcpt", &controllers.AuthController{}, "*:Getcpt")
	beego.Router("/Logout", &controllers.AuthController{}, "*:Logout")

	beego.Router("/upload/VideoUpload", &controllers.UploadController{}, "post:VideoUpload")
	beego.Router("/upload/PhotoUpload", &controllers.UploadController{}, "post:PhotoUpload")

	//	srs视频服务
	beego.Router("/srs/Ondvr", &controllers.SrsController{}, "*:Ondvr")
	beego.Router("/srs/Onconnect", &controllers.SrsController{}, "*:Onconnect")
	beego.Router("/srs/Onpublish", &controllers.SrsController{}, "*:Onpublish")
	beego.Router("/srs/Onclose", &controllers.SrsController{}, "*:Onclose")
	beego.Router("/srs/Onunpublish", &controllers.SrsController{}, "*:Onunpublish")
	beego.Router("/srs/Onstop", &controllers.SrsController{}, "*:Onstop")

	// Long polling.
	//	beego.Router("/gitee.com/lzqysoft/ilive/lp", &controllers.LongPollingController{}, "get:Join")
	//	beego.Router("/gitee.com/lzqysoft/ilive/lp/post", &controllers.LongPollingController{})
	//	beego.Router("/gitee.com/lzqysoft/ilive/lp/fetch", &controllers.LongPollingController{}, "get:Fetch")

	// WebSocket.
	beego.Router("/ws", &controllers.WebSocketController{}, "*:Get")
	beego.Router("/ws/join", &controllers.WebSocketController{}, "*:Join")
	//beego.Router("/ws/fetch", &controllers.WebSocketController{}, "get:Fetch")
	ns := beego.NewNamespace("/ilive",

		beego.NSNamespace("/version",
			beego.NSInclude(
				&controllers.VersionController{},
			),
		),
		beego.NSNamespace("/auth",
			beego.NSInclude(
				&controllers.AuthController{},
			),
		),

		beego.NSNamespace("/srs",
			beego.NSInclude(
				&controllers.SrsController{},
			),
		),

		beego.NSNamespace("/collection",
			beego.NSInclude(
				&controllers.CollectionController{},
			),
		),

		beego.NSNamespace("/livechannel",
			beego.NSInclude(
				&controllers.LivechannelController{},
			),
		),

		beego.NSNamespace("/bulletin",
			beego.NSInclude(
				&controllers.BulletinController{},
			),
		),

		beego.NSNamespace("/client",
			beego.NSInclude(
				&controllers.ClientController{},
			),
		),

		beego.NSNamespace("/log",
			beego.NSInclude(
				&controllers.LogController{},
			),
		),

		beego.NSNamespace("/region",
			beego.NSInclude(
				&controllers.RegionController{},
			),
		),

		beego.NSNamespace("/user",
			beego.NSInclude(
				&controllers.UserController{},
			),
		),

		beego.NSNamespace("/points",
			beego.NSInclude(
				&controllers.PointsController{},
			),
		),

		beego.NSNamespace("/resource",
			beego.NSInclude(
				&controllers.ResourceController{},
			),
		),

		beego.NSNamespace("/userprof",
			beego.NSInclude(
				&controllers.UserprofController{},
			),
		),

		beego.NSNamespace("/dept",
			beego.NSInclude(
				&controllers.DeptController{},
			),
		),

		beego.NSNamespace("/role",
			beego.NSInclude(
				&controllers.RoleController{},
			),
		),

		beego.NSNamespace("/organization",
			beego.NSInclude(
				&controllers.OrganizationController{},
			),
		),

		beego.NSNamespace("/video",
			beego.NSInclude(
				&controllers.VideoController{},
			),
		),

		beego.NSNamespace("/videoscore",
			beego.NSInclude(
				&controllers.VideoscoreController{},
			),
		),

		beego.NSNamespace("/watchhistory",
			beego.NSInclude(
				&controllers.WatchHistoryController{},
			),
		),
		beego.NSNamespace("/statistics",
			beego.NSInclude(
				&controllers.StatisticsController{},
			),
		),
	)
	beego.AddNamespace(ns)
}
